<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>操作DOM的DEMO</title>
</head>

<body>
    <span id="textBox">0</span>
    <br>
    <button id="submit">累加</button>

    <script>
        // 想操作谁，就先获取谁
        let textBox = document.querySelector('#textBox'),
            submit = document.querySelector('#submit');

        // 事件绑定
        let num = 0;
        submit.addEventListener('click', function () {
            num++;
            textBox.innerHTML = num;
        });
    </script>
</body>

</html>